package com.rskg.g_rskg.controller;

import com.rskg.g_rskg.Mapper.UserMapper;
import com.rskg.g_rskg.domin.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class TestController {
    @Resource
    private UserMapper userMapper;

//    @RequestM
//    我们在配置文件定义一个属性 。比如定一个叫xsy = hello
//
//    然后我们在控制器上加一个注解，便 可以在属性中设置这个属性的值
    @Value("${test.hello:TEST}")
   private String testName;
//    apping(v$alue = "/hello", method = RequestMethod.GET)
    @RequestMapping("/hello")
    public String hello() {
        return "127.0.0.1" + testName;
    }

    @GetMapping("/test")
    public List<User> list(){
        System.out.println("list");
        return userMapper.selectByExample(null);
    }


    @PostMapping("/hello/post")
    public String helloPost(String name) {
        return "Hello, " + name + "! (POST)";
    }

}
